package com.ruoyi.elebook.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.elebook.domain.BookCatalogScope;
import com.ruoyi.elebook.mapper.BookCatalogScopeMapper;
import com.ruoyi.elebook.service.IBookCatalogScopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 目录范围Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class BookCatalogScopeServiceImpl implements IBookCatalogScopeService 
{
    @Autowired
    private BookCatalogScopeMapper bookCatalogScopeMapper;

    /**
     * 查询目录范围
     * 
     * @param id 目录范围主键
     * @return 目录范围
     */
    @Override
    public BookCatalogScope selectBookCatalogScopeById(Long id)
    {
        return bookCatalogScopeMapper.selectBookCatalogScopeById(id);
    }

    /**
     * 查询目录范围列表
     * 
     * @param bookCatalogScope 目录范围
     * @return 目录范围
     */
    @Override
    public List<BookCatalogScope> selectBookCatalogScopeList(BookCatalogScope bookCatalogScope)
    {
        return bookCatalogScopeMapper.selectBookCatalogScopeList(bookCatalogScope);
    }

    /**
     * 新增目录范围
     * 
     * @param bookCatalogScope 目录范围
     * @return 结果
     */
    @Override
    public int insertBookCatalogScope(BookCatalogScope bookCatalogScope)
    {
        bookCatalogScope.setCreateTime(DateUtils.getNowDate());
        return bookCatalogScopeMapper.insertBookCatalogScope(bookCatalogScope);
    }

    /**
     * 修改目录范围
     * 
     * @param bookCatalogScope 目录范围
     * @return 结果
     */
    @Override
    public int updateBookCatalogScope(BookCatalogScope bookCatalogScope)
    {
        bookCatalogScope.setUpdateTime(DateUtils.getNowDate());
        return bookCatalogScopeMapper.updateBookCatalogScope(bookCatalogScope);
    }

    /**
     * 批量删除目录范围
     * 
     * @param ids 需要删除的目录范围主键
     * @return 结果
     */
    @Override
    public int deleteBookCatalogScopeByIds(Long[] ids)
    {
        return bookCatalogScopeMapper.deleteBookCatalogScopeByIds(ids);
    }

    /**
     * 删除目录范围信息
     * 
     * @param id 目录范围主键
     * @return 结果
     */
    @Override
    public int deleteBookCatalogScopeById(Long id)
    {
        return bookCatalogScopeMapper.deleteBookCatalogScopeById(id);
    }
}
